package demo3;

public class Car extends BX {
    private double price;
    private int number;
    private double money;

    public Car(double price, int number) {
        this.price = price;
        this.number = number;
    }

    @Override
    public double add() {
        if (number == 0) {
            money = price * 0.02;
        } else if (number == 1) {
            money = price * 0.2*1.1;
        } else {
            money = price * 0.2 * 1.2;
        }
        return money;

    }
}
